<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>五角星评分案例</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        .comment {
            font-size: 40px;
            color: red;
        }
        
        .comment li {
            float: left;
        }
        
        ul {
            list-style: none;
        }
    </style>
    <script src="jQuery版本/jquery-3.6.0.js"></script>
    <script>
        $(function() {
            var wjx_k = "☆";
            var wjx_s = "★";
            $('.comment>li').on('mouseenter', function() {
                $(this).text(wjx_s).prevAll().text(wjx_s);
            }).on('mouseleave', function() {
                $(this).text(wjx_k).siblings().text(wjx_k);
            }).on('click', function() {
                $(this).off();
            })
        });
    </script>
</head>

<body>
    <ul class="comment">
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
        <li>☆</li>
    </ul>
</body>

</html>